import Vue from "vue"
import router from "@/router"
import Store from "../store"

export default {
    mustBeLogin() {
        let token = localStorage.getItem('token')
        if (!token) {
            Vue.prototype.$toast('请先登录!')
            setTimeout(() => {
                console.log(Store)
                //需要在跳转前改成isGoback:true,修改vuex的值,为对象
                // 对象名.方法名()             对象["属性名"]     对象["方法名"]()   
                Store["_mutations"]["isGoback/changeIsGoback"][0](true);
                router.push('/user')
            }, 1000)
            return false
        }
        return true
    }
}